class GameStats:
    """跟踪游戏信息统计"""

    def __init__(self, settings):
        """初始化统计信息"""
        self.settings = settings
        self.reset_stats()

        # 在任何情况下都不应该重置得最高得分
        self.highest_score = 0

        # 显示玩游戏的次数
        self.play_game_frequency = 0

        # 用来管理所有字典的字典
        self.dictionaries = {}

        # 添加显示字符串的字典和控制游戏各种状态的字典
        self.dictionaries['strs'] = {}
        self.dictionaries['active'] = {}

        # 添加控制游戏活跃的各种状态
        self.dictionaries['active']['game_active'] = False
        self.dictionaries['active']['win_str_active'] = False
        self.dictionaries['active']['lost_str_active'] = False
        self.dictionaries['active']['new_record'] = False

        # 添加游戏胜利和失败后显示的文字
        self.dictionaries['strs']['win_str'] = 'You Win!'
        self.dictionaries['strs']['lost_str'] = 'Game Over'

    def reset_stats(self):
        """初始化在游戏运行期间可能变化的统计信息"""
        self.spacecraft_life = self.settings.spacecraft_life_limit
        self.score = 0
        self.level = 1
